import Cookies from "js-cookie";

/**
 * 清除一个本地缓存
 * @param key 键
 * @returns {*}
 */
const removeCookie = (key) => Cookies.remove(key);

/**
 * 设置一个永久的本地缓存
 * @param key
 * @param value
 * @returns {*}
 */
const setCookie = (key, value) => Cookies.set(key, value);
const setCookieExpire = (key, value, expireNumber) => Cookies.set(key, value, {expires: expireNumber});

/**
 * 获取一个JSON对象
 * @param key
 * @returns {*}
 */
const getJsonCookie = (key) => Cookies.getJSON(key);
const getCookie = (key) => Cookies.get(key);


export {
    setCookie,
    setCookieExpire,
    getCookie,
    getJsonCookie,
    removeCookie,
}
